
package com.craterhill.java.ems.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.craterhill.java.ems.common.beans.State;
import com.craterhill.java.ems.service.StateService;

@Controller
public class GeneralDataController {

	private final StateService stateService;

	@Autowired
	public GeneralDataController(final StateService stateService) {
		this.stateService = stateService;
	}

	@RequestMapping("/getStates.ems")
	public @ResponseBody
	List<State> getStates(final @RequestParam int countryId) {
		return stateService.getStates(countryId);
	}
}
